using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using DAL;
using BUS;
using DTO;
using Utility;
public partial class admin_A_NhanVien_insert : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            LoadDropDownList();
        }
    }
    private void LoadDropDownList()
    {
        PhanQuyen_QuanLyColection quanlyCollection = PHANQUYEN_QUANLY_BUS.GetAll();
        ddl_quyen.DataTextField = tbPhanQuyen_QuanLyColumns.TenQuyen.ToString();
        ddl_quyen.DataValueField = tbPhanQuyen_QuanLyColumns.MaQuyen.ToString();
        ddl_quyen.DataSource = quanlyCollection;
        ddl_quyen.DataBind();
        ddl_quyen.Items.Insert(0, new ListItem("All", "0"));

    }
    protected void btn_Update_Click(object sender, EventArgs e)
    {
        try
        {
            NhanVien_DTO nhanVien = new NhanVien_DTO();
            nhanVien.TenNV = txt_Tennv.Text;
            nhanVien.MatKhau = txt_mk.Text;
            nhanVien.TaiKhoan = txt_taiKhoan.Text;
            nhanVien.MaQuyen = int.Parse(ddl_quyen.SelectedValue);
            nhanVien.DiaChi = txt_daichi.Text;
            nhanVien.DienThoai = txt_dienthoai.Text;
            nhanVien.Email = txt_mail.Text;
            NHANVIEN_BUS.Insert(nhanVien);


        }
        catch (Exception ex)
        {
        }
        Response.Redirect("~/admin/A_NhanVien.aspx");
    }
}
